{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加皮肤</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">皮肤：</label>
                            <div class="layui-input-block">
                                <select name="pos_ps_id" lay-filter="role1" xm-select-search="" xm-select-radio="" xm-select-search-type="dl">
                                    <option value="">请选择皮肤</option>
                                    {volist name='skin' id='vo'}
                                    <option value="{$vo.pskin_id}">{$vo.pskin_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">配置选项：</label>
                            <div class="layui-input-block" id="demo5">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">备注：</label>
                            <div class="layui-input-block">
                                <textarea style="width: 578px;height: 50px" name="pos_describe" placeholder="情况描述"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script>
    var res_data = [];
    var demo5;
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('skinAdd')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Privateorder/orderSkin')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
        form.on('select(role1)', function(data){
            var pos_ps_id = data.value;
            $.ajax({
                url: "{:url('Privateorder/showConfig')}",
                type: 'post',
                dataType:'json',
                data:{'pos_po_id':pos_ps_id},
                success:function (res) {
                    if(res.code == 200){
                        res_data = res.msg;
                        demo5 = xmSelect.render({
                            el: '#demo5',
                            language: 'zn',
                            data:res_data
                        });
                    }else{
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>
<script>
    demo5 = xmSelect.render({
        el: '#demo5',
        language: 'zn',
        data:res_data
    });
</script>
</body>
</html>

